"""
    pyQuery需要安装三方库 pip3 install pyquery
    pyQuery可以供html元素获取数据信息
"""
import requests
import pyquery

headers = {
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0'
}

def load_page(_page:int):
    _url = f'https://bbs.a9vg.com/forum-261-{_page}.html'
    res = requests.get(_url)
    res.encoding = 'utf-8'

    doc = pyquery.PyQuery(res.text)
    content = doc('th[class="new"] a[class="s xst"]')
    for item in content:
        print(f'[A9VG]{item.text} {item.attrib["href"]}')


if __name__ == "__main__":
    for index in range(1):
        load_page(index)
        print(f'=============================={index}==============================')